const { createHash, randomBytes } = require('crypto');

class MD5 {
  constructor() {}
  hash(plain) {
    const hash = createHash('md5');
    const salt = randomBytes(32).toString('hex');
    console.log('salt', salt);
    return hash
      .update(plain + salt)
      .digest('hex')
      .toUpperCase();
  }
}

module.exports = MD5;
